package chapter9;

/**
 * 在定义泛型参数时设定上限,此处设置了上限为Number，则使用时的泛型只能
 * 是Number或其子类，否则会编译报错
 */
public class Apple1<T extends Number> {
    T col;

    public static void main(String[] args) {
        Apple1<Integer> a1 = new Apple1<>();
        Apple1<Double> a2 = new Apple1<>();
        //String不是Number的子类，所以编译报错
        //Apple1<String> a3 = new Apple1<String>();
    }
}
